package config

import "sync"

func init() {
	CurrentData = &Point{Data: make(map[string]interface{})}
	LastData = &Point{Data: make(map[string]interface{})}
}

var CurrentData *Point
var LastData *Point

type Point struct {
	mu   sync.RWMutex
	Data map[string]interface{}
}

func (c *Point) Set(data map[string]interface{}) {
	c.mu.Lock()
	defer c.mu.Unlock()
	c.Data = data
}

func (c *Point) Get() map[string]interface{} {
	c.mu.RLock()
	defer c.mu.RUnlock()
	return c.Data
}
